home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
p_robo31.zip
/
WERUN1.PR
< prev
next >
Wrap
Text File
|
1993-02-10
|
7KB
|
198 lines
(**************************************************************************)
(* W A R N I N G *)
(* *)
(* This Robot has NOT been designed to take advantage of the advanced *)
(* features of P-ROBOTS, such as, Shields, Fuel or Obstructions. *)
(**************************************************************************)
{****************************************************************** }
{ robot WERUN1.pr Sandra Swetnick Unger Dec 6, 1989 }
{ tag team with WERUN2.pr }
{****************************************************************** }
PROCEDURE werun1;
TeamAlly = "werun2";
VAR
drv_dir : Integer; { drive direction }
scn_dir : Integer; { scan direction }
range : Integer; { range to oponent }
x, y : Integer; { x and y coordinates }
z : Integer; { z defines the edge of a square }
{ when z exceeds a predefined value }
{ the robot is approaching a wall }
I : Integer; { looping variable }
N : Integer; { width of the scan }
newscan : Integer; { most recent scan direction }
x_max : Integer;
y_max : Integer;
x_switch : Integer;
y_switch : Integer;
{******************************************************************}
{ Determine if the enemy robot is a "Hunter" or a "non-Hunter" }
{ Sit and wait for the enemy robot to attack }
{******************************************************************}
BEGIN { Main }
drv_dir := Angle_To(100, 500);
DRIVE(drv_dir, 100);
scn_dir := Angle_To(500, 500)-90;
REPEAT { find the enemy }
scn_dir := scn_dir+20;
range := SCAN(scn_dir, 10);
UNTIL range <> 0;
CANNON(scn_dir, range);
CANNON(scn_dir, range-20);
{******************************************************************}
BEGIN
REPEAT { get to a side }
x := loc_x;
FOR I := -N TO N DO
BEGIN
newscan := scn_dir+(20*I);
range := SCAN(newscan, 10);
IF (range <> 0) THEN
BEGIN
CANNON(newscan, range);
I := N;
range := SCAN(newscan, 10);
CANNON(newscan, range);
END;
END;
IF (range > 10) THEN scn_dir := newscan
ELSE scn_dir := scn_dir+90;
IF range > 25 THEN CANNON(newscan-12, range);
IF range = 0 THEN N := 2
ELSE N := 1;
IF range > 10 THEN CANNON(newscan+12, range);
DRIVE(drv_dir, 100);
UNTIL x < 250;
REPEAT
REPEAT
drv_dir := Angle_To(100, 100);
DRIVE(drv_dir, 100);
FOR I := -N TO N DO
BEGIN
newscan := scn_dir+(20*I);
range := SCAN(newscan, 10);
IF (range > 10) THEN
BEGIN
CANNON(newscan, range);
I := N;
range := SCAN(newscan, 10);
CANNON(newscan, range);
END;
END;
IF (range > 10) THEN scn_dir := newscan
ELSE IF x < 120 THEN scn_dir := 0
ELSE IF x > 880 THEN scn_dir := 180
ELSE IF y < 120 THEN scn_dir := 90
ELSE IF y > 880 THEN scn_dir := 270
ELSE scn_dir := scn_dir+90;
IF range > 10 THEN CANNON(newscan, range+15);
IF range = 0 THEN N := 2
ELSE N := 1;
IF range > 25 THEN CANNON(newscan, range-15);
y := loc_y;
UNTIL y < 250;
REPEAT
drv_dir := Angle_To(900, 100);
DRIVE(drv_dir, 100);
FOR I := -N TO N DO
BEGIN
newscan := scn_dir+(20*I);
range := SCAN(newscan, 10);
IF (range > 10) THEN
BEGIN
CANNON(newscan, range);
I := N;
range := SCAN(newscan, 10);
CANNON(newscan, range);
END;
END;
IF (range > 10) THEN scn_dir := newscan
ELSE IF x < 120 THEN scn_dir := 0
ELSE IF x > 880 THEN scn_dir := 180
ELSE IF y < 120 THEN scn_dir := 90
ELSE IF y > 880 THEN scn_dir := 270
ELSE scn_dir := scn_dir+90;
IF range > 10 THEN CANNON(newscan, range+15);
IF range = 0 THEN N := 2
ELSE N := 1;
IF range > 25 THEN CANNON(newscan, range-15);
x := loc_x;
UNTIL x > 750;
REPEAT
drv_dir := Angle_To(900, 900);
DRIVE(drv_dir, 100);
FOR I := -N TO N DO
BEGIN
newscan := scn_dir+(20*I);
range := SCAN(newscan, 10);
IF (range > 10) THEN
BEGIN
CANNON(newscan, range);
I := N;
range := SCAN(newscan, 10);
CANNON(newscan, range);
END;
END;
IF (range > 10) THEN scn_dir := newscan
ELSE IF x < 120 THEN scn_dir := 0
ELSE IF x > 880 THEN scn_dir := 180
ELSE IF y < 120 THEN scn_dir := 90
ELSE IF y > 880 THEN scn_dir := 270
ELSE scn_dir := scn_dir+90;
IF range > 10 THEN CANNON(newscan, range+15);
IF range = 0 THEN N := 2
ELSE N := 1;
IF range > 25 THEN CANNON(newscan, range-15);
y := loc_y;
UNTIL y > 750;
REPEAT
drv_dir := Angle_To(100, 900);
DRIVE(drv_dir, 100);
FOR I := -N TO N DO
BEGIN
newscan := scn_dir+(20*I);
range := SCAN(newscan, 10);
IF (range > 10) THEN
BEGIN
CANNON(newscan, range);
I := N;
range := SCAN(newscan, 10);
CANNON(newscan, range);
END;
END;
IF (range > 10) THEN scn_dir := newscan
ELSE IF x < 120 THEN scn_dir := 0
ELSE IF x > 880 THEN scn_dir := 180
ELSE IF y < 120 THEN scn_dir := 90
ELSE IF y > 880 THEN scn_dir := 270
ELSE scn_dir := scn_dir+90;
IF range > 10 THEN CANNON(newscan, range+15);
IF range = 0 THEN N := 2
ELSE N := 1;
IF range > 25 THEN CANNON(newscan, range-15);
x := loc_x;
UNTIL x < 250;
UNTIL DEAD OR WINNER;
END; { end TAG }
END; { Main}